package name.wilbur.course.db.bigone.util;

/**
 * A simple adapter used for MD5 encryption/decryption.
 * For now, we use fast-md5 library from 
 * 		http://www.twmacinta.com/myjava/fast_md5.php.
 * @author wilbur
 *
 */
import java.io.UnsupportedEncodingException;

import com.twmacinta.util.MD5;

public class MyMD5 implements IMD5 {
	MD5 md5;
	
	public MyMD5() {
		md5 = new MD5();
	}
	
	@Override
	public String encrypt(String pass) {
		try {
			md5.Update(pass, null);
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		return md5.asHex();
	}
}
